﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;

namespace WMI.NET.CIM
{
    /// <summary>
    /// The CIM_IRQ class represents an Intel architecture interrupt request line (IRQ). 
    /// </summary>
    public class CIM_IRQ : CIM_SystemResource
    {

        private Nullable<UInt16> _Availability;
        private string _CreationClassName;
        private string _CSCreationClassName;
        private string _CSName;
        private Nullable<UInt32> _IRQNumber;
        private Nullable<Boolean> _Shareable;
        private Nullable<UInt16> _TriggerLevel;
        private Nullable<UInt16> _TriggerType;

        /// <summary>
        /// Availability of the IRQ.
        /// </summary>
        public Nullable<UInt16> Availability { get { return _Availability; } } //TODO enum

        /// <summary>
        /// Name of the class or subclass used in the creation of an instance. When used with other key properties of the class, this property allows all instances of the class and its subclasses to be uniquely identified.
        /// </summary>
        public string CreationClassName { get { return _CreationClassName; } }

        /// <summary>
        /// Scoping computer system's creation class name.
        /// </summary>
        public string CSCreationClassName { get { return _CSCreationClassName; } }

        /// <summary>
        /// Scoping computer system's name.
        /// </summary>
        public string CSName { get { return _CSName; } }

        /// <summary>
        /// Part of the object's key value, IRQ number.
        /// </summary>
        public Nullable<UInt32> IRQNumber { get { return _IRQNumber; } }

        /// <summary>
        /// If TRUE, the IRQ can be shared.
        /// </summary>
        public Nullable<Boolean> Shareable { get { return _Shareable; } }

        /// <summary>
        /// Indicates whether the interruption is triggered by the hardware signal going high or low. 
        /// </summary>
        public Nullable<UInt16> TriggerLevel { get { return _TriggerLevel; } } //TODO enum

        /// <summary>
        /// Type of interruption that can occur.
        /// </summary>
        public Nullable<UInt16> TriggerType { get { return _TriggerType; } } //TODO enum


        /// <summary>
        /// 
        /// </summary>
        /// <param name="mbo"></param>
        public CIM_IRQ(ManagementBaseObject mbo)
            : base(mbo)
        {
            _Availability = mbo.GetUshortValue("Availability");
            _CreationClassName = mbo.GetStringValue("CreationClassName");
            _CSCreationClassName = mbo.GetStringValue("CSCreationClassName");
            _CSName = mbo.GetStringValue("CSName");
            _IRQNumber = mbo.GetUIntValue("IRQNumber");
            _Shareable = mbo.GetBoolValue("Shareable");
            _TriggerLevel = mbo.GetUshortValue("TriggerLevel");
            _TriggerType = mbo.GetUshortValue("TriggerType");
        }

    }
}
